<%--
  Created by IntelliJ IDEA.
  User: 10332
  Date: 2020/8/7
  Time: 2:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt"  prefix="T"%>
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>增加专业</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="${AppPath}/css/font.css">
    <link rel="stylesheet" href="${AppPath}/css/index.css">
    <script type="text/javascript" src="${AppPath}/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${AppPath}/js/index.js"></script>
    <link rel="stylesheet" href="${AppPath}/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${AppPath}/css/font-awesome.min.css">
    <link rel="stylesheet" href="${AppPath}/layer/skin/default/layer.css">

</head>

<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" id="addForm">

            <div class="layui-form-item">
                <label for="majorName" class="layui-form-label">
                    <span class="x-red">*</span>专业名称</label>
                <div class="layui-input-inline">
                    <input type="text" id="majorName" name="majorName"  class="layui-input"></div>
            </div>

            <div class="layui-form-item">
                <label for="deptName" class="layui-form-label">
                    <span class="x-red">*</span>院系</label>
                <div class="layui-input-inline">
                    <select id="deptName" name="deptId" class="valid">
                        <option>请选择院系</option>
                        <T:forEach items="${deptList}" var="dept">
                            <option value="${dept.deptId}">${dept.deptName}</option>
                        </T:forEach>
                    </select>
                </div>
            </div>


            <div class="layui-form-item">
                <label for="save" class="layui-form-label"></label>
                <button id="save" type="button" onclick="addForm()" lay-filter="add" lay-submit="" class="layui-btn">增加</button>
                <button type="reset" class="layui-btn">重置</button>
            </div>
    </form>
    </div>
</div>
<script src="${AppPath}/jquery/jquery-2.1.1.min.js"></script>
<script src="${AppPath}/bootstrap/js/bootstrap.min.js"></script>
<script src="${AppPath}/script/docs.min.js"></script>
<script src="${AppPath}/layer/layer.js"></script>
<script>layui.use(['form', 'layer'],function () {});
        //新增
        function addForm(){
            $.ajax({
                url:"${AppPath}/major/add",
                type:"post",
                data:$("#addForm").serialize(),
                success:function (data) {
                    if(data.result==true){
                        layer.msg("添加成功",{time:1000, icon:1, shift:6},function () {
                            //关闭当前frame
                            xadmin.close();
                            // 可以对父窗口进行刷新
                            xadmin.father_reload();
                        });
                    }else{
                        layer.msg(data.result, {time:1000, icon:2, shift:6},function () {});
                    }
                }
            });
        };
</script>
</body>

</html>
